﻿using AutoMapper;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using WMS.FC.Domain.DomainObject.System;
using WMS.FC.Domain.Service.System;
using WMS.FC.Domain.Service.Tray.Interface;

namespace WMS.FC.Domain.Service.Tray
{
    public class GetTrayBindBarcodeService : ServiceBase, IGetTrayBindBarcodeService
    {
        public GetTrayBindBarcodeService(ILogger<ServiceBase> logger, IOptions<WmsSettings> options, IMapper mapper) : base(logger, options, mapper)
        {
        }

        public async Task<ActionResult<string>> GetTrayBindBarcode(string trayBarcode)
        {
            return await Task.Run(() =>
            {
                var result = new ActionResult<string>("获取托盘条码绑定识别码");
                try
                {
                    result.Data = trayBarcode.Substring(0, 5);
                }
                catch (Exception ex)
                {
                    return result.Exception(ex);
                }

                return result;
            });
        }
    }
}
